import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        int[] arr1 = {1,2,3,0,0,0};
        int[] arr2 = {4,5,6};
        merge(arr1,3,arr2,3);
        for(int i = 0; i < arr1.length; i++) {
            System.out.println(arr1[i]);
        }
//        System.out.println(arr2.toString());
    }
    public static void main1(String[] args) {
        Scanner in = new Scanner(System.in);
        while(in.hasNextLine()) {
            String str = in.nextLine();
            String ret = func(str);
            System.out.println(ret);
        }
    }
    public static String func(String str) {
        StringBuffer sb = new StringBuffer();
        int[] array = new int[127];
        for(int i = 0; i < str.length(); i++) {
            char ch = str.charAt(i);
            if(array[ch] == 0) {
                sb.append(ch);
                array[ch] = 1;
            }
        }
        return sb.toString();
    }

    public static void merge(int A[],int m, int B[],int n) {
        int i = m-1;
        int j = n-1;
        int k = m+n-1;
        while(i >= 0 && j >= 0)  {
            if(A[i] > B[j]) {
                A[k] = A[i];
                k--;
                i--;
            }else {
                A[k] = B[j];
                k--;
                j--;
            }
        }
        while(j >= 0) {
            A[k] = B[j];
            k--;
            j--;
        }
        while(i >= 0) {
            A[k] = A[i];
            k--;
            i--;
        }
    }
}
